<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddOrderRelatedTableAndFields extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::table('lawyer',function($table){
			$table->integer('text_reply_fee')->nullable()->default(0);
			$table->integer('phone_reply_fee')->nullable()->default(0);
		});
		Schema::create('post_order',function(Blueprint $table){
			$table->increments('id');
			$table->integer('post_id');	// 咨询id
			$table->integer('order_id'); // 回复咨询的律师用户的id
            $table->unique(array('post_id', 'order_id'));
		});
		Schema::table('evaluate',function($table){
			$table->dropUnique(array('item_id', 'creator_id'));
			$table->unique(array('item_id', 'creator_id', 'type'));
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		//
	}

}
